home *** CD-ROM | disk | FTP | other *** search
/ World of Video / World of Video.iso / gfxprograms / conversion / pbmplus / tips < prev   
Text File  |  1995-02-13  |  3KB  |  62 lines

  1. Some notes and rules of thumb on using PBM, PGM, PPM, and PNM:
  2.  
  3.  
  4. To make a full-screen version of an image, or as close to it as you can
  5. get, compute the ratio x/y for your image and for your screen.  If the
  6. ratio is higher for your image, do a ppmscale -xsize <screenwidth>; if
  7. your image's ratio is lower, do a ppmscale -ysize <screenheight>.
  8.  
  9. Even margins: an easy way to get nice equal-sized margins on all sides
  10. of a non-full-screen image is to pnmcrop it, get the size and add 10%
  11. or so, pbmmake a bitmap of that size, and pnmpaste the image into the
  12. bitmap.
  13.  
  14. Smoothing when enlarging: if you pnmenlarge or ppmscale up by a factor
  15. of three or more, you should add a ppmsmooth step.  Otherwise you can
  16. see the original pixels in the resulting image.
  17.  
  18. Rotating: as mentioned in its manual entry, pnmflip can be used for 90
  19. degree rotations.  Ppmrotate can be used for other angles between -90
  20. and 90.  To go all the way around the circle, combine these two
  21. programs.
  22.  
  23. When using pbmpaste's logical operations to do masking, it is important
  24. to remember that while the PBM file format represents black as 1 and
  25. white as 0, pbmpaste acts as if the reverse is true: black is 0 and
  26. white is 1.  See the pbmmask manual entry for examples.
  27.  
  28. Enhancing contrast in a grayscale image: do a pgmhist, and look for
  29. likely values of -bvalue and -wvalue to use with pgmnorm.  If you just
  30. want to enhance the contrast, then choose values at elbows in the
  31. histogram; e.g. if value 29 represents 3% of the image but value 30
  32. represents 20%, choose 30 for bvalue.  If you want to lighten the
  33. image, then set bvalue to 0 and just fiddle with wvalue; similarly, to
  34. darken the image, set wvalue to maxval and play with bvalue.
  35.  
  36. Avoid odd-numbered widths.  Displaying them causes problems on some machines.
  37.  
  38. To turn a Usenix FaceSaver image into PBM, first do an "fstopgm > /dev/null".
  39. This will tell you whether you need to use ppmscale.  Then use one of the
  40. following pipelines:
  41.   fstopgm | pnmenlarge -3 | ppmtopgm | pgmnorm | pgmtopbm
  42.   fstopgm | pnmenlarge -3 | ppmscale -whatever | ppmtopgm | pgmnorm | pgmtopbm
  43. Enlarging by more than 3 does not look good.
  44.  
  45. Re-halftoning with pbmreduce: Let's say you have a scanner that only
  46. produces black&white, not grayscale, and it does a terrible job of
  47. halftoning (most scanners fit this description).  One way to fix the
  48. halftoning is to scan at the highest possible resolution, say 300 dpi,
  49. and then reduce by a factor of three or so using pbmreduce.  Pbmreduce
  50. duplicates a lot of the functionality of pgmtopbm -- you could do
  51. something like ppmscale | ppmtopgm | pgmtopbm, but pbmreduce is a lot
  52. faster and doesn't use as much memory.  You can even correct the
  53. brightness of an image with pbmreduce, by using the -value flag.
  54.  
  55. If you compiled with the RAWBITS option, you may sometimes want some
  56. non-raw output.  Maybe you want to use sed to change one color to
  57. another, or something.  Here's one way to get this conversion:  unset
  58. RAWBITS; choose one of the PNM programs that can be used like "cat",
  59. for instance, pnmflip; compile the libraries, compile pnmflip; rename
  60. your non-raw pnmflip to something like pnmunraw; set RAWBITS again, and
  61. recompile things.
  62.